package com.example.demo.Utils;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class TimeUtils {
    public static String getNowTime(){
        SimpleDateFormat sdf = new SimpleDateFormat();// 格式化时间
        sdf.applyPattern("yyyy-MM-dd");
        Date date = new Date();
        return sdf.format(date);
    }

    public static String getThisWeekStart(){
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");

        Calendar c = Calendar.getInstance();

        c.setTime(new Date());

        c.add(Calendar.DATE, - 7);

        Date d = c.getTime();

        String day = format.format(d);

        return day.toString();
    }

}